package jndi.ldap.biz.ad;

import java.util.ArrayList;
import java.util.List;

import jndi.ldap.biz.LdapOperator;
import jndi.ldap.domains.LdapUser;
import jndi.ldap.biz.LdapUserManager;

public class ADUserManager implements LdapUserManager {
    private LdapOperator operator;

    public List<LdapUser> findUsersByName(String username) {
        List<LdapUser> users = new ArrayList<LdapUser>();
        
//        List<String> searchBase = operator.getBaseDN();
//        String searchFilter = "(&(objectClass=user)(userPrincipalName=" + username + "))";
//        SearchControls cons = new SearchControls();
//        cons.setSearchScope(SearchControls.SUBTREE_SCOPE);
//        NamingEnumeration<SearchResult> searchResults = operator.search(searchBase, searchFilter, cons);
//        while (searchResults.hasMoreElements()) {
//            Attributes userAttrs = searchResults.nextElement().getAttributes();
//            LdapUser user = new UserAttributesMapper().mapFromAttributes(userAttrs);
//            users.add(user);
//        }
        
        return users;
    }

    public void setOperator(LdapOperator operator) {
        this.operator = operator;
    }

}
